package kosta.model.reply;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

@Service
public class ReplyServiceImpl implements ReplyService {
	@Resource(name="replyDaoImpl")
	private ReplyDao replyDao;
	@Override
	public void insertReply(ReplyVO rvo) throws SQLException {
		replyDao.insertReply(rvo);
	}
	@Override
	public List<ReplyVO> getListReply(int bno) throws SQLException {
		return replyDao.getListReply(bno);
	}
	@Override
	public void deleteReply(int rno,String id) throws SQLException {
		replyDao.deleteReply(rno);
	}
	@Override
	public void updateReply(ReplyVO rvo) throws SQLException {
		replyDao.updateReply(rvo);	
	}
	public void insertReReply(ReplyVO rvo) throws SQLException {
		System.out.println(rvo+" service");
		int ref = rvo.getRef();
		int relevel = rvo.getRelevel();
		int restep = replyDao.selectRestep(ref); //업데이트할 restep을 select
		System.out.println(restep+" service");
		rvo.setRestep(restep + 1);
		rvo.setRelevel(relevel + 1);
		replyDao.insertReReply(rvo); // 답변 글 입력
	}
	@Override
	public void checkRadpot(int rno) throws SQLException {
		replyDao.checkRadpot(rno);
	}
	@Override
	public void pointPlus(String id) throws SQLException {
		replyDao.pointPlus(id);
	}
}
